<?php

use \Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::namespace('Api\V1')->prefix('v1')->group(function () {

    Route::any('gitPull', function () {
        gitPull();
    });
    // 不需要AES加密和登陆的接口
    Route::any('test', 'TestController@index')->name('test');
    Route::post('monitor', 'MonitorController@do')->name('monitor');

    Route::any('up', 'UploadController@up')->name('up');
    Route::any('upload', 'UploadController@upload')->name('upload');
    Route::any('uploadVideo', 'UploadController@upVideo')->name('uploadVideo');
    Route::any('qiniuToken', 'UploadController@qiniuToken')->name('qiniuToken');

    Route::middleware('check.aes')->group(function () {

        // 登陆注册的接口
        Route::any('login', 'JwtAuthController@login')->name('user.login');
        Route::any('register', 'JwtAuthController@register')->name('user.register');
        Route::any('forgetPass', 'JwtAuthController@forgetPass')->name('user.forgetPass');
        Route::any('guestLogin', 'JwtAuthController@guestLogin')->name('user.guestLogin');

        // 第三方登陆接口
        Route::any('login/weixin', 'AuthController@weixin');
        Route::any('login/weixin/callback', 'AuthController@weixinCallback');
        Route::any('login/qq', 'AuthController@qq');
        Route::any('login/qq/callback', 'AuthController@qqCallback');
        Route::any('login/weibo', 'AuthController@weibo');
        Route::any('login/weibo/callback', 'AuthController@weiboCallback');

        // 不需要登陆接口
        Route::any('captchaGet', 'CaptchaController@get')->name('captcha.get');
        Route::any('smsGet', 'SmsController@get')->name('sms.get');
        Route::any('emailGet', 'EmailController@get')->name('email.get');
        Route::any('vipShop', 'UserController@vipShop')->name('user.vipShop');
        Route::any('tagsList', 'UserController@tagsList')->name('user.tagsList');
        Route::any('user/search', 'UserController@search')->name('user.search');
        Route::any('user/get', 'UserController@get')->name('user.get');
        Route::any('searchList', 'UserController@searchList')->name('user.searchList');
        Route::any('groupUserList', 'UserController@groupUserList')->name('user.groupUserList');
        Route::any('groupList', 'UserController@groupList')->name('user.groupList');
        Route::any('saveBook', 'UserController@saveBook')->name('user.saveBook');
        Route::any('speakList', 'UserController@speakList')->name('user.speakList');
        //新闻模块
        Route::any('new/list', 'NewController@index')->name('new.list');
        Route::any('new/add', 'NewController@add')->name('new.add');
        Route::any('new/show/{id}', 'NewController@show')->name('new.show');
        Route::any('new/category', 'NewController@getNewCategory')->name('new.category');
        //小说漫画
        Route::any('chapter/list', 'BookChaptersController@list')->name('chapter.list');//章节列表
        Route::any('book/list', 'BooksController@getlist')->name('book.list');//书籍列表
        Route::any('book/info', 'BooksController@getBookinfo')->name('book.info');//书籍列表
        Route::any('chapter/info', 'BookChaptersController@getinfo')->name('chapter.info');//章节详情
        Route::any('book/type', 'BookTypeController@list')->name('book.type');//书籍分类
        Route::any('bookcom/list', 'BookCommentsController@list')->name('bookcom.list');//评论列表
//        Route::any('book/historys', 'BookHistoryController@getHistoryInfo')->name('book.historys');//阅读历史
//        Route::any('book/collection/add', 'BookCollectionController@add')->name('book.collection.add');//加入书架

        // 代理
        Route::any('agentList', 'UserController@agentList')->name('user.agentList');

        // 配置接口
        Route::any('config', 'ConfigController@get')->name('config.get');
        Route::any('system', 'SystemController@get')->name('system.get');

        Route::any('version', 'VersionController@get')->name('version.get');

        // 分类
        Route::any('category', 'CategoryController@get')->name('category.get');
        Route::any('goodsCategory', 'GoodsCategoryController@get')->name('goodsCategory.get');
        Route::any('speakCategory', 'SpeakCategoryController@get')->name('speakCategory.get');

        // 公司
        Route::prefix('company')->group(function () {
            Route::any('list', 'CompanyController@list')->name('company.list');
            Route::any('departmentList', 'CompanyController@departmentList')->name('company.departmentList');
            Route::any('departmentSave', 'CompanyController@departmentSave')->name('company.departmentSave');
            Route::any('departmentDel', 'CompanyController@departmentDel')->name('company.departmentDel');
        });

        // 商品
        Route::prefix('goods')->group(function () {
            Route::any('list', 'GoodsController@list')->name('goods.list');
            Route::any('view', 'GoodsController@view')->name('goods.view');
        });

        // 礼物
        Route::prefix('gift')->group(function () {
            Route::any('list', 'GiftController@list')->name('gift.list');
            Route::any('me', 'GiftController@me')->name('gift.me');
            Route::any('receive', 'GiftController@receive')->name('gift.receive');
        });

        // 广告
        Route::prefix('advert')->group(function () {
            Route::any('list', 'AdvertController@list')->name('advert.list');
            Route::any('view', 'AdvertController@view')->name('advert.view');
        });

        // 话题
        Route::prefix('topic')->group(function () {
            Route::any('list', 'TopicController@list')->name('topic.list');
        });

        // 视频
        Route::prefix('video')->group(function () {
            Route::any('list', 'VideoController@list')->name('video.list');
            Route::any('me', 'VideoController@me')->name('video.me');
            Route::any('referList', 'VideoController@referList')->name('video.referList');
            Route::any('view', 'VideoController@view')->name('video.view');
            Route::any('historyAdd', 'VideoController@historyAdd')->name('video.historyAdd');
        });

        // 收藏
        Route::prefix('collect')->group(function () {
            Route::any('list', 'CollectController@list')->name('collect.list');
        });

        // 点赞
        Route::prefix('like')->group(function () {
            Route::any('list', 'LikeController@list')->name('like.list');
        });

        // 评论
        Route::prefix('comment')->group(function () {
            Route::any('list', 'CommentController@list')->name('comment.list');
            Route::any('commentList', 'CommentController@commentList')->name('comment.commentList');
        });

        // 图文
        Route::prefix('article')->group(function () {
            Route::any('list', 'ArticleController@list')->name('article.list');
            Route::any('me', 'ArticleController@me')->name('article.me');
            Route::any('view', 'ArticleController@view')->name('article.view');
            Route::any('followList', 'ArticleController@followList')->name('article.followList');
        });

        // 直播
        Route::prefix('live')->group(function () {
            Route::any('list', 'LiveController@list')->name('live.list');
            Route::any('view', 'LiveController@view')->name('live.view');
            Route::any('start', 'LiveController@start')->name('live.start');
            Route::any('close', 'LiveController@close')->name('live.close');
            Route::any('history', 'LiveController@history')->name('live.history');
        });

        // 音视频
        Route::prefix('audio')->group(function () {
            Route::any('removeUser', 'AudioController@removeUser')->name('audio.removeUser');
            Route::any('dismissRoom', 'AudioController@dismissRoom')->name('audio.dismissRoom');
        });

        // 影视分类
        Route::any('movieCategory', 'MovieCategoryController@get')->name('movieCategory.get');

        // 影视
        Route::prefix('movie')->group(function () {
            Route::any('index', 'MovieController@index')->name('movie.index');
            Route::any('list', 'MovieController@list')->name('movie.list');
            Route::any('view', 'MovieController@view')->name('video.view');
            Route::any('detailList', 'MovieController@detailList')->name('movie.detailList');
            Route::any('historyAdd', 'MovieController@historyAdd')->name('movie.historyAdd');
        });

        // 任务中心
        Route::prefix('task')->group(function () {
            Route::any('list', 'TaskController@list')->name('task.list');
            Route::any('receive', 'TaskController@receive')->name('task.receive');
        });

        // 支付
        Route::prefix('pay')->group(function () {
            Route::any('return', 'PayController@return')->name('pay.return');
            Route::any('notify', 'PayController@notify')->name('pay.notify');
            Route::any('notifyVip', 'PayController@notifyVip')->name('pay.notifyVip');
        });

        // 需要登陆接口
        Route::middleware('refresh.token')->group(function () {
            // 登录相关
            Route::any('user', 'JwtAuthController@user')->name('user.user');
            Route::any('bookcom/add', 'BookCommentsController@add')->name('bookcom.add');//添加书籍评论
            Route::any('bookcom/start', 'BookCommentsController@getStart')->name('bookcom.start');//给评论点赞
            Route::any('book/collection/list', 'BookCollectionController@list')->name('book.collection.list');//我的书架
            Route::any('book/collection/add', 'BookCollectionController@add')->name('book.collection.add');//加入书架
            Route::any('book/historys', 'BookHistoryController@getHistoryInfo')->name('book.historys');

            Route::any('forget', 'JwtAuthController@forget')->name('user.forget');
            Route::any('logout', 'JwtAuthController@logout')->name('user.logout');
            Route::any('refer', 'UserController@refer')->name('user.refer');
            Route::any('accountLog', 'UserController@accountLog')->name('user.accountLog');
            Route::any('withdrawLog', 'UserController@withdrawLog')->name('user.withdrawLog');
            Route::any('withdraw', 'UserController@withdraw')->name('user.withdraw');
            Route::any('informLog', 'UserController@informLog')->name('user.informLog');
            Route::any('inform', 'UserController@inform')->name('user.inform');
            Route::any('vipLog', 'UserController@vipLog')->name('user.vipLog');
            Route::any('bindPhone', 'UserController@bindPhone')->name('user.bindPhone');
            Route::any('bindEmail', 'UserController@bindEmail')->name('user.bindEmail');
            Route::any('complete', 'UserController@complete')->name('user.complete');
            Route::any('bindCompany', 'UserController@bindCompany')->name('user.bindCompany');
            Route::any('saveTags', 'UserController@saveTags')->name('user.saveTags');
            Route::any('searchAdd', 'UserController@searchAdd')->name('user.searchAdd');
            Route::any('searchDel', 'UserController@searchDel')->name('user.searchDel');
            Route::any('share', 'UserController@share')->name('user.share');
            Route::any('download', 'UserController@download')->name('user.download');
            Route::any('downloadList', 'UserController@downloadList')->name('user.downloadList');
            Route::any('sameUserList', 'UserController@sameUserList')->name('user.sameUserList');
            Route::any('agentNum', 'UserController@agentNum')->name('user.agentNum');
            Route::any('agentInfo', 'UserController@agentInfo')->name('user.agentInfo');
            Route::any('agentEarnings', 'UserController@agentEarnings')->name('user.agentEarnings');
            Route::any('user/saveGroup', 'UserController@saveGroup')->name('user.saveGroup');
            Route::any('user/delGroup', 'UserController@delGroup')->name('user.delGroup');
            Route::any('user/joinGroup', 'UserController@joinGroup')->name('user.joinGroup');
            Route::any('user/quitGroup', 'UserController@quitGroup')->name('user.quitGroup');
            Route::any('user/decShareNum', 'UserController@decShareNum')->name('user.decShareNum');
            Route::any('user/signin', 'UserController@signin')->name('user.signin');
            Route::any('user/signView', 'UserController@signView')->name('user.signView');
            Route::any('user/signList', 'UserController@signList')->name('user.signList');
            Route::any('user/speakRelate', 'UserController@speakRelate')->name('user.speakRelate');
            Route::any('user/groupTagsList', 'UserController@groupTagsList')->name('user.groupTagsList');
            Route::any('user/saveGroupTags', 'UserController@saveGroupTags')->name('user.saveGroupTags');
            Route::any('user/delGroupTags', 'UserController@delGroupTags')->name('user.delGroupTags');
            Route::any('user/groupTagsSort', 'UserController@groupTagsSort')->name('user.groupTagsSort');
            Route::any('user/groupTagsRelateList', 'UserController@groupTagsRelateList')->name('user.groupTagsRelateList');
            Route::any('user/addGroupTagsRelate', 'UserController@addGroupTagsRelate')->name('user.addGroupTagsRelate');
            Route::any('user/delGroupTagsRelate', 'UserController@delGroupTagsRelate')->name('user.delGroupTagsRelate');

            Route::any('user/relateList', 'UserController@relateList')->name('user.relateList');
            Route::any('user/relate', 'UserController@relate')->name('user.relate');
            Route::any('user/delRelate', 'UserController@delRelate')->name('user.delRelate');

            Route::any('user/blacklist', 'UserController@blacklist')->name('user.blacklist');
            Route::any('user/addBlacklist', 'UserController@addBlacklist')->name('user.addBlacklist');
            Route::any('user/delBlacklist', 'UserController@delBlacklist')->name('user.delBlacklist');

            // 支付
            Route::prefix('pay')->group(function () {
                Route::any('do', 'PayController@do')->name('pay.do');
                Route::any('doVip', 'PayController@doVip')->name('pay.doVip');
                Route::any('vip', 'PayController@vip')->name('pay.vip');
            });

            // 打赏
            Route::any('user/give', 'UserController@give')->name('user.give');

            // 视频扣费
            Route::any('user/rebate', 'UserController@rebate')->name('user.rebate');

            // 卡密兑换
            Route::any('cipher/receive', 'CipherController@receive')->name('cipher.receive');

            // 消息接口
            Route::any('message/get', 'MessageController@get')->name('message.get');
            Route::any('message/list', 'MessageController@list')->name('message.list');
            Route::any('message/getList', 'MessageController@getList')->name('message.getList');
            Route::any('message/read', 'MessageController@read')->name('message.read');
            Route::any('message/del', 'MessageController@del')->name('message.del');

            // 公司
            Route::prefix('company')->group(function () {
                Route::any('add', 'CompanyController@add')->name('company.add');
            });

            // 商品
            Route::prefix('goods')->group(function () {
                Route::any('add', 'GoodsController@add')->name('goods.add');
                Route::any('edit', 'GoodsController@edit')->name('goods.edit');
                Route::any('pay', 'GoodsController@pay')->name('goods.pay');
            });

            // 订单
            Route::prefix('order')->group(function () {
                Route::any('list', 'OrderController@list')->name('order.list');
                Route::any('do', 'OrderController@do')->name('order.do');
                Route::any('pay', 'OrderController@pay')->name('order.pay');
                Route::any('cancel', 'OrderController@cancel')->name('order.cancel');
                Route::any('back', 'OrderController@back')->name('order.back');
            });

            // 礼物
            Route::prefix('gift')->group(function () {
                Route::any('give', 'GiftController@give')->name('gift.give');
            });

            // 视频
            Route::prefix('video')->group(function () {
                Route::any('add', 'VideoController@add')->name('video.add');
                Route::any('del', 'VideoController@del')->name('video.del');
                Route::any('historyList', 'VideoController@historyList')->name('video.historyList');
            });

            // 图文
            Route::prefix('article')->group(function () {
                Route::any('add', 'ArticleController@add')->name('article.add');
                Route::any('del', 'ArticleController@del')->name('article.del');
            });

            // 关注
            Route::prefix('follow')->group(function () {
                Route::any('fans', 'FollowController@fans')->name('follow.fans');
                Route::any('me', 'FollowController@me')->name('follow.me');
                Route::any('on', 'FollowController@on')->name('follow.on');
                Route::any('off', 'FollowController@off')->name('follow.off');
            });

            // 收藏
            Route::prefix('collect')->group(function () {
                Route::any('me', 'CollectController@me')->name('collect.me');
                Route::any('on', 'CollectController@on')->name('collect.on');
                Route::any('off', 'CollectController@off')->name('collect.off');
            });

            // 点赞
            Route::prefix('like')->group(function () {
                Route::any('me', 'LikeController@me')->name('like.me');
                Route::any('on', 'LikeController@on')->name('like.on');
                Route::any('off', 'LikeController@off')->name('like.off');
            });

            // 评论
            Route::prefix('comment')->group(function () {
                Route::any('add', 'CommentController@add')->name('comment.add');
                Route::any('onLike', 'CommentController@onLike')->name('comment.onLike');
                Route::any('offLike', 'CommentController@offLike')->name('comment.offLike');
                Route::any('del', 'CommentController@del')->name('comment.del');
                Route::any('me', 'CommentController@me')->name('comment.me');
            });
            // 阅读评论top30
//            Route::any('rzroad', 'RzroadController@index')->name('rzroad.get');
            // 影视
            Route::prefix('movie')->group(function () {
                Route::any('historyList', 'MovieController@historyList')->name('movie.historyList');
            });
        });
    });
//    // 阅读评论top30
    Route::any('rzroad', 'RzroadController@index')->name('rzroad.get');
});
